<%@page import="Entity.Comment"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.text.DateFormat"%>
<%@page import="Entity.Event"%>
<%@page import="Entity.Account"%>
<%
            if ((session.getAttribute("Admin_Session") == null)||(session.getAttribute("User_Session") != null))
            {
                response.sendRedirect(request.getContextPath() + "/index.jsp");
            } else {
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>National Level Paper Presentation</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<link href="css/white/style.css" media="screen" title="shadow" rel="stylesheet" type="text/css" />
<link href="css/demo_table.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script>
    jQuery.noConflict();
</script>
<script type="text/javascript" language="javascript" src="js/jquery.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf-8">
			$(document).ready(function() {
				$('#TableCom').dataTable( {
					"aaSorting": [[ 4, "desc" ]]
				} );
			} );
</script>

</head>
<body>

<div id="templatemo_body_wrapper">
<div id="templatemo_wrapper">

	<div id="tempaltemo_header">
    	<div id="header_content">
		</div>
    </div> <!-- end of header -->

    <div id="templatemo_main_top"></div>
    <div id="templatemo_main">

        <div id="templatemo_sidebar">

        	<div id="templatemo_menu">
<%
        if(session.getAttribute("Admin_Session")!=null)
            {

            Account ac = (Account)session.getAttribute("Admin_Session");

%>
<table>
    <tr>
            <%
                   if(ac.getAvatar()!=null)
                       {
            %>
                  <td><img class="avatarAdmin" src="images/avatar/<%= ac.getAvatar() %>"/></td>
            <%
                        }else{
            %>
                  <td><img class="avatarAdmin" src="images/avatar/avatar.jpg"/></td>
            <%
                        }
             %>
    </tr>
    <tr>
        <td align="center"><strong>Information</strong></td>

    </tr>
    <tr>
<%
        if(ac.getGender().equals("Male"))
            {
%>
    <td>Mr:</td>
<%
       }else
        {
%>
    <td>Ms:</td>
<%
        }
%>
<td><%= ac.getFullname() %></td>
    </tr>
    <tr>
        <td>Address: </td>
	<td><%= ac.getAddress() %></td>
    </tr>
    <tr>
        <td><a href="ADUpdateProfile.jsp">More Profile</a></td>
	<form action="LoginServlet" method="post">
            <td><input type="submit" name="action" value="Sign Out" class="Button"/> </td>
        </form>
    </tr>
</table>
<%}%>
<br/>
<br/>
                    <ul>
                    <li><a href="AdminHome.jsp" target="_parent">Home</a></li>
                    <li><a href="MinhNHServlet?action=AdviewAccount" target="_parent">Manage Account</a></li>
                    <li><a href="VietDQServlet?action=GetAllEvents" target="_parent">Manage Events</a></li>
                    <li><a href="PhuocPHServlet?action=GetListCate" target="_parent">Manage Category</a></li>
                    <li><a href="VietDQServlet?action=AdviewFAQ" target="_parent">Manage FAQ</a></li>
                    <li><a href="PhuocPHServlet?action=ManageFB" target="_parent">Manage FeedBack</a></li>
                    <li><a href="PhuocPHServlet?action=manageComment" target="_parent" class="current">Manage Comment</a></li>
              </ul>
            </div> <!-- end of templatemo_menu -->
            <div class="cleaner"></div>
        </div> <!-- end of sidebar -->

        <div id="templatemo_content">

            <div class="content_box">
                    <h2>MANAGE COMMENT</h2>
              <div class="cleaner h30"></div>

<table cellpadding="0" cellspacing="0" border="0" class="display" id="TableCom" width="100%">
	<thead>
		<tr>
			<th>Events Name</th>
			<th>Username</th>
			<th>Comment</th>
			<th>Date Create</th>
                        <th>Option</th>
		</tr>
	</thead>
	<tbody>
            <%
                   DateFormat df = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
                   Comment[] comresult = (Comment[])session.getAttribute("ADVIEWCOM");
                       for (int i = 0; i < comresult.length; i++) {
                       String date = df.format(comresult[i].getDateCreate());
            %>
                <tr class="gradeU">
                    <td align="center">
                    <%
                            if(comresult[i].getEvent().getEvName().length() > 15)
                                {
                    %>
                            <%= comresult[i].getEvent().getEvName().toString().substring(0, 15)%>...
                    <%
                        }else
                            {
                    %>
                            <%= comresult[i].getEvent().getEvName()%>
                    <%
                        }
                    %>
                    </td>
                    <td align="center">
                        <%
                         if(comresult[i].getAccount().getUsername().length() >15)
                                    {
                        %>
                        <%= comresult[i].getAccount().getUsername().substring(0, 15) %>...
                        <%
                                }else
                                    {
                        %>
                                <%= comresult[i].getAccount().getUsername() %>
                        <%
                            }
                        %>
                    </td>
                    <td align="center"><a href="PhuocPHServlet?action=DetailCom&txtIdCom=<%= comresult[i].getCmID()%>">
                            <%
                         if(comresult[i].getComment().length() >15)
                                    {
                        %>
                        <%= comresult[i].getComment().substring(0, 15) %>...</a>
                        <%
                                }else
                                    {
                        %>
                                <%= comresult[i].getComment() %>
                        <%
                            }
                        %>
                        </td>
                        <td><%= date %></td>
                        <td align="center">
<%
    if(comresult[i].getIDelete()==false)
        {
%>
<a href="PhuocPHServlet?action=Close&idClose=<%= comresult[i].getCmID()%>"onclick="return confirm('Are you sure close ?')"><span class="style1">Close</span></a>
<%
    }else
    {
%>
<a href="PhuocPHServlet?action=Open&idOpen=<%= comresult[i].getCmID()%>">Open</a>
<%
    }
%>
                        </td>
		</tr>
<%
            }
%>

	</tbody>
	<tfoot>
		<tr>
			<th>Events Name</th>
			<th>Username</th>
			<th>Comment</th>
			<th>Date Create</th>
                        <th>Option</th>
		</tr>
	</tfoot>
</table>
          </div>

        </div>

        <div class="cleaner"></div>
    </div>

    <div id="templatemo_main_bottom">
    </div>

</div> <!-- end of wrapper -->
</div>

<div id="templatemo_footer_wrapper">
	<div id="templatemo_footer">
        Copyright © 2012 <a href="#">KSC Technology and Sciences</a> |
                Designed by <a href="#">Group_05_F2-1104-T1_FAT2_FPT-Aptech</a>

    </div>
</div>

</body>
</html>
<%
    }
%>